package com.graduation.mapper;

import com.graduation.model.ProductEntity;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description 商品实体类对应的Mapper
 * @Author YaoQi
 * @Date 2018/3/21 23:39
 */
public interface ProductMapper {

    /**
     * 商品实体对应的数据库表
     */
    String PRODUCT_TABLE_NAME = "WEB_SHOPPING_PRODUCT";

    @Select(
            "SELECT ID, SELLERID, SHOPID, CLASSID, PRODUCT_NAME AS productName, PRODUCT_KEYWORD AS productKeyWord," +
                    "PRODUCT_DECP AS productDecp, ADDRESS, PRICE, PICTURE, STOCK, BRANDS, SELL_NUM AS sellNum, VIEW," +
                    "CREATE_TIME AS createTime, CREATE_USER AS createUser, UPDATE_TIME AS updateTime, UPDATE_USER AS updateUser" +
                    " FROM " + PRODUCT_TABLE_NAME
    )
    List<ProductEntity> getProductList();

    @Select({
            "INSERT INTO", PRODUCT_TABLE_NAME,"VALUES( SELLERID={#}",
    })
    int addProduct();
}
